﻿using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DevUIUtils
{
    public class ComboBoxEditEx : ComboBoxEdit
    {
        [Browsable(true)]
        [Description("字符串下拉项数据源")]
        public BindingList<string> ItemsSource_String
        {
            get
            {
                BindingList<string> list = new BindingList<string>();
                foreach (string item in base.Properties.Items)
                {
                    list.Add(item);
                }
                return list;
            }
            set
            {
                base.Properties.Items.Clear();
                base.Properties.Items.AddRange(value.ToArray());
            }
        }

        [Browsable(true)]
        [Description("对象下拉项数据源")]
        public BindingList<object> ItemsSource_Object
        {
            get
            {
                BindingList<object> list = new BindingList<object>();
                foreach (var item in base.Properties.Items)
                {
                    list.Add(item);
                }
                return list;
            }
            set
            {
                base.Properties.Items.Clear();
                base.Properties.Items.AddRange(value.ToArray());
            }
        }
    }
}
